@extends('layouts.back_stage')
@section('style')
    @parent
    <style>
        .qrDiv{
            position: relative;
            /*left: -15px;*/
            height:1200px;
            text-align: center;
        }
        .info{
            display: inline-block;
        }
    </style>
@endsection
@section('content')
    <div class="container">
        <h3>二维码列表</h3>
        <a class="btn btn-info" href="/applyForCargo" style="position: relative;left: 80%">返回</a>
        <a class="btn btn-primary" href="#" style="position: relative;left: 85%" onclick="preview()">打印</a>
        <input type="hidden" id="pro_id" value="{{$id}}" >
        <!--startprint-->
        <ul style="padding-left: 0">
                    <li style="list-style: none;margin-bottom: 30px;" >
                        <div class="qrDiv" style="height: auto">
                            <div style="width: 350px;margin: auto;">
                                <div style="margin:0 auto 20px;">
                                    <img src="{{env('CDN_DOMAIN_NAME')}}/qrcodes/{{$qrcodeInfo['qrcode']}}.png"
                                         style="width: 200px;height: 200px;position: relative;top: 8px;">
                                </div>
                                <div>要货公司:{{$qrcodeInfo['company_name']}}</div>
                                <div>二维码:{{$qrcodeInfo['qrcode']}}</div>
                                <div class="info">
                                    <span>品牌:</span><br/>
                                    <span>款号:</span><br/>
                                    <span>颜色:</span><br/>
                                    <span>数量/手:</span><br/>
                                </div>
                                <div class="info">
                                    @foreach($infos as $val)
                                        @foreach($val as $v)
                                            <span style="margin-left: 20px">{{$v}}</span>
                                        @endforeach
                                        <br/>
                                    @endforeach
                                </div>
                            </div>
                        </div>
                    </li>
        </ul>

    </div>
    @include('errors.list')
    <script>
        function preview() {
            var bdhtml = window.document.body.innerHTML;//获取当前页的html代码
            var startStr = "<!--startprint-->";//设置打印开始区域
            var endStr = "<!--endprint-->";//设置打印结束区域
            var printHtml = bdhtml.substring(bdhtml.indexOf(startStr) + startStr.length, bdhtml.indexOf(endStr));//从标记里获取需要打印的页面
            window.document.body.innerHTML = printHtml;//需要打印的页面
            window.print();
            window.document.body.innerHTML = bdhtml;//还原界面
        }
    </script>
@endsection
